#include "../Path.h"

#include <windows.h>

namespace AlgoTrading
{
	namespace Common
	{

		extern std::wstring GetCurrentExecutableDirctoryPath()
		{
			wchar_t buffer[MAX_PATH];
			::GetModuleFileNameW( NULL, buffer, MAX_PATH );

			std::wstring filePath(buffer);
			size_t found = filePath.find_last_of(L"/\\");

			return filePath.substr(0,found);
		}

		extern std::wstring CombinePath(const std::wstring& p1, const std::wstring& p2)
		{
			std::wstring result = p1;
			size_t found = result.find_last_of(L"/\\");
			if (found != (result.length() - 1))
			{
				result += L"\\";
			}
			result += p2;
			return result;
		}

	}
}